import request from '@/utils/request'

// 分类列表
export function listCategories(query) {
  return request({
    url: '/category/page',
    method: 'get',
    params: query
  })
}

// 获取所有分类（不分页）
export function listAllCategories() {
  return request({
    url: '/category/list',
    method: 'get'
  })
}

// 获取分类详情
export function getCategory(id) {
  return request({
    url: `/category/${id}`,
    method: 'get'
  })
}

// 新增分类
export function addCategory(data) {
  return request({
    url: '/category',
    method: 'post',
    data: data
  })
}

// 修改分类
export function updateCategory(data) {
  return request({
    url: '/category',
    method: 'put',
    data: data
  })
}

// 删除分类
export function deleteCategory(id) {
  return request({
    url: `/category/${id}`,
    method: 'delete'
  })
} 